// server/utils/fileUtils.js

// 检查是否存在重复的子数组
exports.hasDuplicateGroups = (data, historicalData) => {
  const historicalSet = new Set(historicalData.map((group) => JSON.stringify(group)))

  for (const [key, value] of Object.entries(data)) {
    if (!Array.isArray(value)) continue

    for (const group of value) {
      const groupStr = JSON.stringify(group.sort((a, b) => a - b))
      if (historicalSet.has(groupStr)) {
        return true // 存在重复
      }
    }
  }

  return false // 无重复
}
